#include "buletooth.h"

void buletooth_init(void)
{
	USART3_INIT(9600);
}

char* B_CheckData(char *sdat, char *dat) // 检查数据
{
	char *strx = 0;
	
	strx = strstr((const char*)sdat, (const char*)dat);
	return strx;
}

void B_SendData(char *fmt,...) // 发送数据
{
	unsigned char UsartPrintfBuf[256];
	va_list ap;
	unsigned char *pStr = UsartPrintfBuf;
	
	va_start(ap, fmt);
	vsnprintf((char *)UsartPrintfBuf, sizeof(UsartPrintfBuf), fmt, ap);							//格式化
	va_end(ap);
	
	while(*pStr != 0)
	{
		USART_SendData(BUSARTTYPE, *pStr++);
		while(USART_GetFlagStatus(BUSARTTYPE, USART_FLAG_TC) == RESET);
	}
}
